<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="dist/themes/default/style.min.css"/>
<link rel="stylesheet" href="css/login_dialog.css"/>
<link rel="stylesheet" href="css/announcements.css"/>
<script src="//cdn.jsdelivr.net/npm/sha256-uint8array/dist/sha256-uint8array.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="dist/jstree.min.js"></script>
<script src="dist/jquery.leanModal.min.js"></script>
<script src="/js/main.js?v=0.1.3" type="module"></script>
</head>
<body>
<h3>Klippy Web API Test</h3>
<div id="term" style="width: 60em; height: 20em; overflow:auto; border: 1px solid black">
</div>
<br/>
<input id="cbxAuto" type="checkbox" name="Autoscroll" checked="true"/> Autoscroll
<input id="cbxSub" type="checkbox" name="AutoSub" checked="true"/> Subscribe on Ready
<input id="cbxFileTransfer" type="checkbox" checked="true" name="FileEnable"/> Allow File Operations While Printing
<br/><br/>
<input type="radio" name="test_type" value="http" checked="true">Test HTTP API
<input type="radio" name="test_type" value="websocket">Test Websocket API
<br/><br/>
<form id="gcform">
<input type="text" />
<input type="submit" value="Send GCode"/>
</form>
<br/>
<form id="apiform">
    <input type="text" style="width: 30em" id="apirequest" name="apirequest" value="/printer/objects/list"
    title="Should be a url for a http request, ie: /printer/objects/list, or a json-rpc registered
    method name."/>
    <input type="text" style="width: 20em" id="apiargs" name="apiargs"
    title="Arguments for a websocket request.  Arguments should be specified in as a JSON object, without
    brackets." hidden/>
    <input type="submit" value="Send API Command"/>
    <span id="apimethod">
    <input type="radio" name="api_cmd_type" value="get" checked="true">GET
    <input type="radio" name="api_cmd_type" value="post">POST
    <input type="radio" name="api_cmd_type" value="delete">DELETE
    </span>
    <span id="wstype" hidden>
    <input type="radio" name="socket_type" value="primary" checked="true">Primary WS
    <input type="radio" name="socket_type" value="bridge">Bridge WS
    </span>
</form>
<br/>
<div style="display: flex">
<div style="width: 10em">
  <button id="btnpauseresume" style="width: 9em">Pause Print</button><br/><br/>
  <button id="btncancelprint" style="width: 9em">Cancel Print</button><br/><br/>
</div>
<a id="hidden_link" href="#" hidden>hidden</a>
<input type="file" style="display:none" id="upload-file" />
<div id="filelist">
</div>
</div>
<br/>
Progress: <progress id="progressbar" value="0" max="100"></progress>
<span id="upload_progress">0%</span><br/><br/>
<button id="btnsetinstance" style="width: 9em">Set Instance</button>
<button id="btnsetidentity" style="width: 9em">Set Identity</button>
<button id="btnqueryendstops" style="width: 9em">Query Endstops</button>
<button id="btnsubscribe" style="width: 9em">Post Subscription</button>
<button id="btngetfiles" style="width: 9em">Get File List</button>
<button id="btngethelp" style="width: 9em">Get Gcode Help</button>
<button id="btngetobjs" style="width: 9em">Get Object List</button>
<br/><br/>
<button id="btnestop" style="width: 9em">E-Stop</button>
<button id="btnrestart" style="width: 9em">Restart</button>
<button id="btnfirmwarerestart" style="width: 9em">Firmware Restart</button>
<button id="btnreboot" style="width: 9em">Reboot OS</button>
<button id="btnshutdown" style="width: 9em">Shutdown OS</button>
<button id="btngetlog" style="width: 9em">Klippy Log</button>
<button id="btnmoonlog" style="width: 9em">Moonraker Log</button>
<br/><br/>
<button id="btnloginuser" style="width: 9em">Login User</button>
<button id="btncreateuser" style="width: 9em">Create User</button>
<button id="btnsetapikey" style="width: 9em">Set API Key</button>
<button id="btnlogout" style="width: 9em" class="req-login">Log Out</button>
<button id="btndeluser" style="width: 9em" class="req-login">Delete User</button>
<button id="btnchangepass" style="width: 9em" class="req-login">Change Pass</button>
<button id="btnannouncements" style="width: 9em">Announcements</button>
<br/><br/>
<button id="btntestmesh" style="width: 9em">Get Bed Mesh</button>
<button id="btnsendbatch" class="reqws" style="width: 9em">Test GC Batch</button>
<button id="btnsendmacro" class="reqws" style="width: 9em">Test GC Macro</button>

<br/><br/>
<span id="filename" hidden></span></br>
<div id="streamdiv">
</div>

<a id="nav_home" href="#" hidden>Hidden Home</a>
<a id="do_login" rel="leanModal" name="login" href="#login" hidden>Hidden Login</a>
<div id="login" class="user">
    <div id="login-ct">
        <div id="login-header" class="user-header">
            <h2>Moonraker Login</h2>
            <button id="login_close" class="modal_close"></button>
        </div>

        <form id="login_form" class="user-form">
            <div class="text-field">
                <label for="login_username">Username</label>
                <input id="login_username" class="good_input" name="login_username" type="text" />
            </div>
            <div class="text-field">
                <label for="login_password">Password</label>
                <input id="login_password" name="login_password" type="password" />
            </div>
            <div class="button-field">
                <button type="submit" class="user-button">Login</button>
            </div>
        </form>
    </div>
</div>

<a id="do_deleteuser" rel="leanModal" name="deleteuser" href="#deleteuser" hidden>Hidden Delete</a>
<div id="deleteuser" class="user">
    <div id="login-ct">
        <div id="deleteuser-header" class="user-header">
            <h2>Delete User</h2>
            <button id="deleteuser_close" class="modal_close"></button>
        </div>

        <form id="deleteuser_form" class="user-form">
            <div class="text-field">
                <label for="deleteuser_username">Username</label>
                <input id="deleteuser_username" class="good_input" name="deleteuser_username" type="text" />
            </div>
            <div class="button-field">
                <button type="submit" class="user-button">Submit</button>
            </div>
        </form>
    </div>
</div>

<a id="do_signup" rel="leanModal" name="signup" href="#signup" hidden>Hidden Signup</a>
<div id="signup" class="user">
    <div id="signup-ct">
        <div id="signup-header" class="user-header">
            <h2>Create User</h2>
            <button id="signup_close" class="modal_close"></button>
        </div>
        <form id="signup_form" class="user-form">
            <div class="text-field">
                <label for="signup_username">Username</label>
                <input id="signup_username" class="good_input" name="signup_username" type="text" />
            </div>
            <div class="text-field">
                <label for="signup_password">Password</label>
                <input id="signup_password" name="signup_password" type="password" />
            </div>
            <div class="text-field">
                <label for="signup_verify_pass">Re-Enter Password</label>
                <input id="signup_verify_pass" name="signup_verify_pass" type="password" />
            </div>
            <div class="button-field">
                <button type="submit" class="user-button">Signup</button>
            </div>
        </form>
    </div>
</div>

<a id="do_changepass" rel="leanModal" name="changepass" href="#changepass" hidden></a>
<div id="changepass" class="user">
    <div id="changepass-ct">
        <div id="changepass-header" class="user-header">
            <h2>Change Password</h2>
            <button id="changepass_close" class="modal_close"></button>
        </div>
        <form id="changepass_form" class="user-form">
            <div class="text-field">
                <label for="changepass_oldpass">Current Password</label>
                <input id="changepass_oldpass" name="changepass_oldpass" type="password" />
            </div>
            <div class="text-field">
                <label for="changepass_newpass">New Password</label>
                <input id="changepass_newpass" name="changepass_newpass" type="password" />
            </div>
            <div class="text-field">
                <label for="changepass_verify_pass">Re-Enter New Password</label>
                <input id="changepass_verify_pass" name="changepass_verify_pass" type="password" />
            </div>
            <div class="button-field">
                <button type="submit" class="user-button">Submit</button>
            </div>
        </form>
    </div>
</div>

<a id="do_setinstance" rel="leanModal" name="setinstance" href="#setinstance" hidden></a>
<div id="setinstance" class="user">
    <div id="setinstance-ct">
        <div id="setinstance-header" class="user-header">
            <h2>Set Instance</h2>
            <button id="setinstance_close" class="modal_close"></button>
        </div>
        <form id="setinstance_form" class="user-form">
            <div class="text-field">
                <label for="setinstance_url">URL: </label>
                <input id="setinstance_url" name="setinstance_url" type="text" />
            </div>
            <div class="button-field">
                <button type="submit" class="user-button">Submit</button>
                <button type="button" class="user-button" id="btnresetinstanceurl">Reset</button>
            </div>
        </form>
    </div>
</div>

<a id="do_announce" rel="leanModal" name="announce" href="#announcements" hidden></a>
<div id="announcements" class="announcement">
    <div id="announcements-ct">
        <div id="announce-header" class="anheader">
            <h2>Announcements</h2>
            <button id="announcement_close" class="modal_close"></button>
        </div>
        <div id="announcement_list" class="list"></div>
    </div>
</div>

<a id="do_setidentity" rel="leanModal" name="setidentity" href="#setidentity" hidden></a>
<div id="setidentity" class="user">
    <div id="setidentity-ct">
        <div id="setidentity-header" class="user-header">
            <h2>Set Identity</h2>
            <button id="setidentity_close" class="modal_close"></button>
        </div>
        <form id="setidentity_form" class="user-form">
            <div class="text-field">
                <label for="setidentity_name">Name: </label>
                <input id="setidentity_name" name="setidentity_name" type="text" />
            </div>
            <div class="text-field">
                <label for="setidentity_version">Version: </label>
                <input id="setidentity_version" name="setidentity_version" type="text" />
            </div>
            <div class="text-field">
                <label for="setidentity_type">Type: </label>
                <input id="setidentity_type" name="setidentity_type" type="text" />
            </div>
            <div class="button-field">
                <button type="submit" class="user-button">Submit</button>
            </div>
        </form>
    </div>
</div>

</body>
</html>
